package com.yanqu.road.server.cmd.mail;

import com.yanqu.road.pb.mail.MailProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.mail.MailModule;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;
import com.yanqu.road.server.command.Cmd;

@Cmd(code = Protocol.S_MAIL_GET_ALL_REWARD, desc = "一键领取日常邮件奖励")
public class GetAllMailRewardCmd extends AbstractCommand {

    String allReward;

	@Override
	public boolean parseData(YanQuMessage packet) throws Exception {
		return true;
	}

	@Override
	public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        allReward = player.getModule(MailModule.class).getAllDailyMailReward();
	}

	@Override
	public void sendData(GamePlayer player) {
		MailProto.MailGetAllRewardRespMsg.Builder builder = MailProto.MailGetAllRewardRespMsg.newBuilder();
		builder.setRet(ret);
		builder.setReward(allReward);
		player.sendPacket(Protocol.U_MAIL_GET_ALL_REWARD, builder);
	}

}
